package cn.zhaozhiqi.service.impl;

import cn.zhaozhiqi.pojo.domain.DriverSetting;
import cn.zhaozhiqi.mapper.DriverSettingMapper;
import cn.zhaozhiqi.properties.DriverSettingPriperties;
import cn.zhaozhiqi.service.IDriverSettingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 司机配置 服务实现类
 * </p>
 *
 * @author zhaozhiqi
 * @since 2024-12-17
 */
@Service
public class DriverSettingServiceImpl extends ServiceImpl<DriverSettingMapper, DriverSetting> implements IDriverSettingService {

    @Autowired
    private DriverSettingPriperties prop;
    @Override
    public void create(long driverId) {
        //司机注册后同步进行t_driver_setting 司机配置表的保存
        DriverSetting setting = new DriverSetting();
        setting.setId(driverId);
        setting.setOrderDistance(prop.getOrderDistance());
        setting.setRangeDistance(prop.getRangeDistance());
        setting.setCreateTime(new Date());
        super.save(setting);
    }
}
